home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 2000 October / Software of the Month - Ultimate Collection Shareware 277.iso / pc / PROGRAMS / UTILITY / WINLINUX / DATA1.CAB / usr_-_Usr_Files / INCLUDE / STDIO.H < prev    next >
Encoding:
C/C++ Source or Header  |  1999-09-17  |  6.9 KB  |  248 lines

  1. /* This is part of the iostream/stdio library, providing -*- C -*- I/O.
  2.    Define ANSI C stdio on top of C++ iostreams.
  3.    Copyright (C) 1991 Per Bothner.
  4.  
  5. This library is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU Library General Public
  7. License as published by the Free Software Foundation; either
  8. version 2 of the License, or (at your option) any later version.
  9.  
  10.  
  11. This library is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14. Library General Public License for more details.
  15.  
  16. You should have received a copy of the GNU Library General Public
  17. License along with this library; if not, write to the Free
  18. Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19. */
  20.  
  21. /*
  22.  *    ANSI Standard: 4.9 INPUT/OUTPUT <stdio.h>
  23.  */
  24.  
  25. #ifndef _STDIO_H
  26. #define _STDIO_H
  27. #undef _STDIO_USES_IOSTREAM
  28. #define _STDIO_USES_IOSTREAM 1
  29.  
  30. #ifdef __linux__
  31. #include <features.h>
  32. #endif
  33.  
  34. #include <libio.h>
  35.  
  36. #ifndef NULL
  37. #ifdef __cplusplus
  38. #define NULL 0
  39. #else
  40. #define NULL (void*)0
  41. #endif
  42. #endif
  43.  
  44. #ifndef EOF
  45. #define EOF (-1)
  46. #endif
  47. #ifndef BUFSIZ
  48. #define BUFSIZ 1024
  49. #endif
  50.  
  51. #define _IOFBF 0 /* Fully buffered. */
  52. #define _IOLBF 1 /* Line buffered. */
  53. #define _IONBF 2 /* No buffering. */
  54.  
  55. #define SEEK_SET 0
  56. #define SEEK_CUR 1
  57. #define SEEK_END 2
  58.  
  59.  /* define size_t.  Crud in case <sys/types.h> has defined it. */
  60. #if !defined(_SIZE_T) && !defined(_T_SIZE_) && !defined(_T_SIZE)
  61. #if !defined(__SIZE_T) && !defined(_SIZE_T_) && !defined(___int_size_t_h)
  62. #if !defined(_GCC_SIZE_T) && !defined(_SIZET_)
  63. #define _SIZE_T
  64. #define _T_SIZE_
  65. #define _T_SIZE
  66. #define __SIZE_T
  67. #define _SIZE_T_
  68. #define ___int_size_t_h
  69. #define _GCC_SIZE_T
  70. #define _SIZET_
  71. typedef _IO_size_t size_t;
  72. #endif
  73. #endif
  74. #endif
  75.  
  76. typedef struct _IO_FILE FILE;
  77. typedef _IO_fpos_t fpos_t;
  78.  
  79. #define FOPEN_MAX     _G_FOPEN_MAX
  80. #define FILENAME_MAX _G_FILENAME_MAX
  81.  
  82. /* limited by the number of possible unique combinations. see
  83.  * libio/iotempname.c for details. */
  84. #define TMP_MAX 238328
  85.  
  86. #define P_tmpdir      "/tmp"
  87. #define L_tmpnam      20
  88.  
  89. /* For use by debuggers. These are linked in if printf
  90.  * or fprintf are used. */
  91. extern FILE *stdin, *stdout, *stderr;
  92.  
  93. #ifdef __SVR4_I386_ABI_L1__
  94.  
  95. /* This is for SVR4 Intel x86 ABI only. Don't use it directly. */
  96. extern FILE __iob [];
  97.  
  98. #define stdin  (&__iob [0])
  99. #define stdout (&__iob [1])
  100. #define stderr (&__iob [2])
  101.  
  102. #else
  103.  
  104. #define stdin _IO_stdin
  105. #define stdout _IO_stdout
  106. #define stderr _IO_stderr
  107.  
  108. #endif
  109.  
  110. __BEGIN_DECLS
  111.  
  112. extern void clearerr __P((FILE*));
  113. extern int fclose __P((FILE*));
  114. extern int feof __P((FILE*));
  115. extern int ferror __P((FILE*));
  116. extern int fflush __P((FILE*));
  117. extern int fgetc __P((FILE *));
  118. extern int fgetpos __P((FILE* fp, fpos_t *pos));
  119. extern char* fgets __P((char*, int, FILE*));
  120. extern FILE* fopen __P((__const char*, __const char*));
  121. extern int fprintf __P((FILE*, __const char* format, ...));
  122. extern int fputc __P((int, FILE*));
  123. extern int fputs __P((__const char *str, FILE *fp));
  124. extern size_t fread __P((void*, size_t, size_t, FILE*));
  125. extern FILE* freopen __P((__const char*, __const char*, FILE*));
  126. extern int fscanf __P((FILE *fp, __const char* format, ...));
  127. extern int fseek __P((FILE* fp, long int offset, int whence));
  128. extern int fsetpos __P((FILE* fp, __const fpos_t *pos));
  129. extern long int ftell __P((FILE* fp));
  130. extern size_t fwrite __P((__const void*, size_t, size_t, FILE*));
  131. extern int getc __P((FILE *));
  132. extern int getchar __P((void));
  133. extern char* gets __P((char*));
  134. extern void perror __P((__const char *));
  135. extern int printf __P((__const char* format, ...));
  136. extern int putc __P((int, FILE *));
  137. extern int putchar __P((int));
  138. extern int puts __P((__const char *str));
  139. extern int remove __P((__const char*));
  140. extern int rename __P((__const char* _old, __const char* _new));
  141. extern void rewind __P((FILE*));
  142. extern int scanf __P((__const char* format, ...));
  143. extern void setbuf __P((FILE*, char*));
  144. extern void setlinebuf __P((FILE*));
  145. extern void setbuffer __P((FILE*, char*, int));
  146. extern int setvbuf __P((FILE*, char*, int mode, size_t size));
  147. extern int sprintf __P((char*, __const char* format, ...));
  148. extern int sscanf __P((__const char* string, __const char* format, ...));
  149. extern FILE* tmpfile __P((void));
  150. extern char* tmpnam __P((char*));
  151. extern int ungetc __P((int c, FILE* fp));
  152. extern int vfprintf __P((FILE *fp, char __const *fmt0, _G_va_list));
  153. extern int vprintf __P((char __const *fmt, _G_va_list));
  154. extern int vsprintf __P((char* string, __const char* format, _G_va_list));
  155.  
  156. #if !defined(__STRICT_ANSI__)
  157. extern int vfscanf __P((FILE*, __const char *, _G_va_list));
  158. extern int vscanf __P((__const char *, _G_va_list));
  159. extern int vsscanf __P((__const char *, __const char *, _G_va_list));
  160.  
  161. extern int getw __P((FILE*));
  162. extern int putw __P((int, FILE*));
  163.  
  164. extern char* tempnam __P((__const char *__dir, __const char *__pfx));
  165.  
  166.  
  167. #ifdef __GNU_LIBRARY__
  168.  
  169. #ifdef  __USE_BSD
  170. extern int sys_nerr;
  171. extern char *sys_errlist[];
  172. #endif
  173. #ifdef  __USE_GNU
  174. extern int _sys_nerr;
  175. extern char *_sys_errlist[];
  176. #endif
  177.  
  178. #ifdef  __USE_MISC
  179. /* Print a message describing the meaning of the given signal number. */
  180. extern void psignal __P ((int __sig, __const char *__s));
  181. #endif /* Non strict ANSI and not POSIX only.  */
  182.  
  183. #endif /* __GNU_LIBRARY__ */
  184.  
  185. #endif /* __STRICT_ANSI__ */
  186.  
  187. #ifdef __USE_GNU
  188. extern _IO_ssize_t getdelim __P ((char **, size_t *, int, FILE*));
  189. #if 0 
  190. /* Don't use this name. It is way too common. H.J. */
  191. extern _IO_ssize_t getline __P ((char **, size_t *, FILE *));
  192. #endif
  193.  
  194. extern int snprintf __P ((char *, size_t, const char *, ...));
  195. extern int vsnprintf __P ((char *, size_t, const char *, _G_va_list));
  196.  
  197. extern int asprintf __P((char **, const char *, ...));
  198. extern int vasprintf __P((char **, const char *, _G_va_list));
  199. #endif
  200.  
  201. #if !defined(__STRICT_ANSI__) || defined(_POSIX_SOURCE)
  202. extern FILE *fdopen __P((int, __const char *));
  203. extern int fileno __P((FILE*));
  204. extern FILE* popen __P((__const char*, __const char*));
  205. extern int pclose __P((FILE*));
  206.  
  207. #define L_ctermid     9
  208. #define L_cuserid     9
  209.  
  210. /* Return the name of the controlling terminal. */
  211. extern char *ctermid __P((char *__buf));
  212.  
  213. /* get character login name of the user. */
  214. extern char *cuserid __P((char * __buf));
  215.  
  216. #endif
  217.  
  218. extern int __underflow __P((struct _IO_FILE*));
  219. extern int __overflow __P((struct _IO_FILE*, int));
  220.  
  221. #if defined(_POSIX_THREAD_SAFE_FUNCTIONS) || defined(_REENTRANT)
  222.  
  223. #ifndef __SVR4_I386_ABI_L1__
  224. #define getc_unlocked(fp)    _IO_getc(fp)
  225. #define getchar_unlocked()    getc_unlocked(stdin)
  226. #define putc_unlocked(x, fp)    _IO_putc(x,fp)
  227. #define putchar_unlocked(x)    putc_unlocked(x, stdout)
  228. #endif
  229.  
  230. extern void flockfile __P((FILE *));
  231. extern void funlockfile __P((FILE *));
  232. extern int ftrylockfile __P((FILE *));
  233.  
  234. #else
  235.  
  236. #ifndef __SVR4_I386_ABI_L1__
  237. #define getc(fp) _IO_getc(fp)
  238. #define putc(c, fp) _IO_putc(c, fp)
  239. #define putchar(c) putc(c, stdout)
  240. #define getchar() getc(stdin)
  241. #endif
  242.  
  243. #endif
  244.  
  245. __END_DECLS
  246.  
  247. #endif /*!_STDIO_H*/
  248.